<#include "layout/template.ftl"/>

<@htmlHead title="楼层管理">
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="${resources}/assets/css/jquery-ui.css" />
		<link rel="stylesheet" href="${resources}/assets/css/datepicker.css" />
		<link rel="stylesheet" href="${resources}/assets/css/ui.jqgrid.css" />
		<link rel="stylesheet" href="${resources}/plugins/jqgrid/4.6/jqgrid.extend.css" />
</@htmlHead>


 
<@htmlBody 'page' 'floorManage'>

	<!-- breadcrumbs begin -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '页面管理' '楼层管理'></@breadcrumbs>
	<!-- breadcrumbs start -->

	<!-- page-content begin -->
	<div class="page-content">
			
			<!-- page-header begin -->
			<div class="page-header">
				<h1>
					<i class="fa fa-trophy"></i>&nbsp;楼层管理列表
					<a href="${path}/manage/page/floor/create" class="btn btn-warning pull-right">
						<i class="ace-icon fa fa-plus"></i> 新 增
					</a>
				<h1>
				
				<!--查询 条件 begin-->
				<div style="margin-top:20px;padding:10px 0px 0px 0px;border-top:1px solid #307ecc">
					<div style="float:right">
						<button id="find_btn"  class="btn btn-primary">
							<i class="ace-icon fa fa-search"></i>查 询
						</button>
				    </div>
				    
				    <div id="query" class="query-view" style="">
						<ul class="list-inline">
							<li>
								<label>名称：</label><input type="text" class="input" id="name" name="name" data-op="cn"  /> 
							</li>
						</ul>
					</div>
				    
				</div>
				<!--查询 条件 end-->
			</div>
			<!-- page-header end -->

			<!-- form begin -->
			<div class="row">	
				<div class="col-md-12">
					<!-- jqGrid begin -->
				  	<table id="grid-table"></table>
			 		<div id="grid-pager"></div>
			 		<!-- jqGrid end -->
	
				</div>
			</div>	
			<!-- form end -->
	</div>		
	<!-- page-content end -->	


</@htmlBody>



<@htmlBodyScript>
		<script src="${resources}/assets/js/date-time/bootstrap-datepicker.js"></script>
		<script src="${resources}/assets/js/jqGrid/jquery.jqGrid.src.js"></script>
		<script src="${resources}/assets/js/jqGrid/i18n/grid.locale-cn.js"></script>

		<script>
			var $path ='${path}';
			var grid_selector = "#grid-table";
			var pager_selector = "#grid-pager";
			
			$(function(){
				//分页插件开始
				$("#grid-table").jqGrid({
					url: '${path}/manage/page/floor/list',
				 	mtype : "post", 
					datatype: "json",
					//prmNames : {search : "search"},  
					colNames:[ 'ID','楼层名称','排序','状态','创建时间','操作'],
				 	colModel: [
						{name:'id',index:'id', width:60},
						{name:'name',index:'name'},
						{name:'seq', width:100,editable:true,editrules:{number:true}},
						{
							name:'status',
							width:60,
							formatter:function(cellValue, options, rowObject) {
								var option = '<div class="ui-status">';
								if(cellValue==0){
									option+= "<span class='label label-sm label-danger'>已删除</span>";
								}
								else if(cellValue==1){
									option+= "<span class='label label-sm label-success'>正常</span>";
								}else if(cellValue==2){
									option+= "<span class='label label-sm label-danger'>已禁用</span>";
								}
								option = option +'</div>';      
			               		return option;  
							}
						},
						{
							name:'createTime',
							width:100,
							formatter:function(cellValue, options, rowObject) {
								var output = moment(cellValue).format('YYYY-MM-DD');
								return output;
							}
						},
						{
							name:'id',
							width: 150,
							sortable:false,
							formatter :function(cellvalue, options, rawObject) {
					    		var option = '<div class="ui-op">';
					    
					    		option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="编辑"  tag="'+cellvalue+'"  href="${path}/manage/page/floor/update/'+cellvalue+'" >编辑';
				                option = option +'</a>';
				                option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="详情"  tag="'+cellvalue+'"  href="${path}/manage/page/floorItem/list/'+cellvalue+'" >详情';
				                option = option +'</a>';
				                if(rawObject.status==1){
						    		option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="禁用"  tag="'+cellvalue+'"  href="${path}/manage/page/floor/disable/'+cellvalue+'"  onclick=\'return confirm("是否禁用该楼层详细?");\' >禁用';
					                option = option +'</a>';
								}
				                if(rawObject.status==2  || rawObject.status==0){ 
			                		option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="启用"  tag="'+cellvalue+'"  href="${path}/manage/page/floor/enable/'+cellvalue+'"  onclick=\'return confirm("是否启用该楼层详细?");\' >启用';
				               	 	option = option +'</a>';
								}
 								if(rawObject.status==1 || rawObject.status==2){
			                		option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="删除"  tag="'+cellvalue+'"  href="${path}/manage/page/floor/delete/'+cellvalue+'"  onclick=\'return confirm("是否删除该楼层详细?");\'>删除';
	                				option = option +'</a>'; 
								}
				                option = option +'</div>';      
			               		return option;  
							}
						}
					],
					viewrecords: true, 							// 在toolbar显示的当前页数,步长,总数
					autowidth: true,								//自动宽度
					height: 350,
					rowNum: 10,
					rowList:[10,20,30],
					sortname: 'id',
					sortorder: 'desc',
					pager: "#grid-pager",
					caption: "列表",
					cellEdit: true ,
				  	cellsubmit: 'remote' ,
    				cellurl: '${path}/manage/page/floor/update/seq',
					loadComplete : function() {
						var table = this;
						setTimeout(function(){
							styleCheckbox(table);
							updateActionIcons(table);
							updatePagerIcons(table);
							enableTooltips(table);
						}, 0);
					}
					
				});
				//分页插件结束
				
				//------------------------------- 自定义查询开始 -------------------------------
				//自定义查询开始
				$("#find_btn").click(function(){ 
					searchData('${path}/manage/page/floor/list');
			    }); 
				//自定义查询结束
				
			})
		</script>	
	    <script src="${resources}/assets/js/jqGrid/jquery.jqGrid.Extract.js"></script>
	    

</@htmlBodyScript>